<div class="loading-container"><div class="loader"></div></div>

<div class="wrapper wrapper-shadow wrapper-list"> 
	<!-- list data wrapper -->
	<div class="result-wrapper no-padding">
   	<div class="result-body">
   		<div class="tabs">
      	<ul class="nav nav-tabs widget no-margin-bottom">
        	<li class="active"> 
         		<a href="#tab-content" data-toggle="tab"> 
         			<span class="menu-icon"><i class="fa fa-user-plus"></i></span> 资源设置
           	</a>
         	</li>
        </ul>
        <div class="tab-content no-border xs-padding">
					<div class="tab-pane active" id="tab-content">
           	<div id="toolbar" class="btn-group">
					    <button type="button" class="btn btn-success" onclick="handlerCreate(this);"  data-editor-path="/miwawa/content/system/assets/editor/" data-editor-page="add.html">
			        	<i class="glyphicon glyphicon-random"></i> 新增
					    </button>
						</div>
           	<table data-ajax="handlerSearch" 
       					 	 data-method="post" 
       					 	 data-search="true" 
       					 	 data-toolbar="#toolbar" 
       					 	 data-id-field="id" 
       					 	 data-unique-id="id" 
       					 	 data-pagination="true" 
       					 	 data-detail-view="true"
       					 	 data-show-toggle="true" 
       					 	 data-show-refresh="true" 
       					 	 data-show-columns="true" 
       					 	 data-check-on-init="true" 
       					 	 data-click-to-select="true" 
       					 	 data-side-pagination="server" 
       					 	 data-mobile-responsive="true" 
       					 	 data-event-onload="handlerSuccess" 
       					 	 data-event-onRowExpand="handlerDetail" 
       					 	 data-form-search="#search-form-system" id="table-system" class="bootstrap-table">
							<thead>
								<tr>
									<th data-checkbox="true"></th>
									<th data-field="id" 				data-visible="false" data-switchable="false">ID</th>
									<th data-field="name" 			data-align="center" >系统名称</th>
									<th data-field="code" 			data-align="center" >系统编码</th>
									<th data-field="operator" 	data-align="center" data-width="65" data-formatter="renderOperator" data-table-target="system">操作</th>
								</tr>
							</thead>
						</table>
        	</div>
      	</div>
    	</div>
   	</div>
	</div>

	<!-- form editor wrapper -->
	<div class="editor-wrapper">
		
	</div>
	
	<!-- form modal wrapper -->
	<div class="modal-wrapper">
	
	</div>
</div>
<!-- PAGE CONTENT END =============================================== -->

<!-- 查询表单 ========================================================= -->
<form id="search-form-system" action="/miwawa/default/common/search.json" method="post" 
			name="com.app.miwawa.api.system.entity.Assets">
			<input type="hidden" name="pid" value="0" data-search-group="and" data-search-operation="EQ">
			<input type="hidden" name="status" value="0" data-search-group="and" data-search-operation="EQ">
			<input type="hidden" name="invalid" value="F" data-search-group="and" data-search-operation="EQ">
			<input type="hidden" data-search-sort="createDate" data-search-order="desc">
</form>

<!-- 删除表单 ========================================================= -->
<form id="remove-form-system" action="/miwawa/default/common/remove" method="post" name="com.app.miwawa.api.system.entity.Assets"></form>
			
<!-- Javascript ===================================================== -->
<script src="/miwawa/resources/lib/miwawa/1.0.2/js/core/requirejs/require.js"></script>

<script type="text/javascript">
<!--
	var columns = [
		{ checkbox: true }, 
		{ field: 'id', 				visible: false, switchable:false }, 
		{ field: 'name', 			halign:'center', title: '模块名称' },
		{ field: 'code', 			halign:'center', title: '模块编码' },
		{ field: 'sort', 			halign:'center', title: '排序号' },
		{ field: 'operator',	halign:'center', title: '操作' }	
	];
	
	jQuery(function(){
		require(['/miwawa/resources/lib/miwawa/1.0.2/js/core/module/app/simple.js'], function(simple){
			simple(['registerForm','registerTable','registerWidget']);
		});
	});
	
	function handlerDetail(index, row, element){
		var $el = element.html('<table></table>').find('table');
		
		$el.bootstrapTable({
    	columns: columns
    });
	}

	function renderOperator(value, row, index){
		switch(this.tableTarget){
			case "system":
				return "<a class='btn btn-info 	 btn-xs btn-table-op' onclick='handlerCreate(this, \""+row.id+"\")' data-table-source='#table-system' data-editor-path='/miwawa/content/system/assets/editor' data-editor-page='edit.html' data-toggle='tooltip' data-placement='top' title='查看与编辑'> <i class='ion-compose'></i> </a>"
						 + "<a class='btn btn-danger btn-xs btn-table-op' onclick='handlerRemove(this, \""+row.id+"\")' data-table-source='#table-system' data-form-source='#remove-form-system' data-toggle='tooltip' data-placement='top' title='删除'> <i class='fa fa-trash'></i> </a>";
			case "module":
			case "actions":
			case "function":
				return row.id != "new" ?
							 "<a class='btn btn-danger btn-xs btn-table-op' onclick='handlerRemove(this, \""+row.id+"\")' data-table-source='#table-function' data-form-source='#remove-form-system' data-toggle='tooltip' data-placement='top' title='删除'> <i class='fa fa-trash'></i> </a>"
							 :value;
		}
	}
//-->
</script>
